import Vue from 'vue'
import { USER_INFO, ENHANCE_PRE } from '@/store/mutation-types'
const getters = {
  device: state => state.app.device,
  theme: state => state.app.theme,
  color: state => state.app.color,
  token: state => state.user.token,
  username: state => state.user.username,
  welcome: state => state.user.welcome,
  permissionList: state => state.user.permissionList,
  menuList: state => state.user.menuList,
  userInfo: state => state.user.info,
  roleList: state => state.user.roleList,
  dictList: state => state.user.dictList,
  addRouters: state => state.permission.addRouters,
  whetherAllPermission: state => state.user.roleList[0].roleCode === 'admin',
  enhanceJs: state => code => {
    state.enhance.enhanceJs[code] = Vue.ls.get(ENHANCE_PRE + code)
    return state.enhance.enhanceJs[code]
  }
}

export default getters
